package com.lions.client.view.gui;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.lions.client.controller.Controller;
import com.lions.client.model.Model;
import com.lions.client.view.audio.AudioOutput;

/**
 * 
 * @author Brad
 * 
 */
public class LoginHandler {

	/**
	 * Creates the MainGUI panel once correct login information has been
	 * entered.
	 */
	public LoginHandler(RootLayoutPanel rp) {
		rootLayoutPanel = rp;
		checkLogin();
	}

	/**
	 * Call this method to display the login screen. Login panel will call the
	 * loginSuccess() method if success.
	 */
	public void checkLogin() {
		login = new LoginPanel(this);
		rootLayoutPanel.add(login);
	}

	/**
	 * Called on a successful login Call this directly to skip the login screen
	 * (for debugging)
	 */
	public void loginSuccess() {
		Model model = new Model();
		rootLayoutPanel.clear();
		login = null;
		rootLayoutPanel.add(new com.lions.client.view.gui.MainPanel(model,
				new Controller(model)));
		new AudioOutput().playLogin();

	}

	private RootLayoutPanel rootLayoutPanel;
	private LoginPanel login;
	private TenDayPopup tenDay;
}
